package enduringLink.call;

import enduringLink.MyProxy;
import io.netty.channel.socket.nio.NioSocketChannel;
import local.LocalInstance;
import producer.BigFileReader;
import producer.PartAndLineItemHandler;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class MyStartLoad implements StartLoad{
    private static int instanceId;
    @Override
    public void begin() {
        System.out.println("开始加载......");
        int fileReaderThreadNum = 0;
        try {
            InputStream is = PartAndLineItemHandler.class.getClassLoader().getResourceAsStream("address.properties");
            Properties properties = new Properties();
            properties.load(is);
            fileReaderThreadNum = Integer.parseInt(properties.getProperty("fileReaderThreadNum"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        File file1 = new File("D:\\tcp\\tpc介绍\\part.txt");
        File file2 = new File("D:\\tcp\\tpc介绍\\lineitem.txt");
        BigFileReader reader = new BigFileReader(file1, file2, fileReaderThreadNum, 0, 1, instanceId);
        reader.start();//正式开始加载数据
    }

    public MyStartLoad(int id){
        instanceId = id;
    }
    public MyStartLoad(){

    }

}
